package com.webchat.pgc.repository.dao;

import com.webchat.pgc.repository.entity.ArticleEntity;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;

import java.util.Collection;


@Repository
public interface IArticleDAO extends JpaSpecificationExecutor<ArticleEntity>,
        JpaRepository<ArticleEntity, Long> {


    @Transactional
    @Modifying
    @Query(value = "update ArticleEntity a set a.status = 2 where a.id in :ids")
    int updatePushedStatus(Collection<Long> ids);

}